Skip to content

refactor: opentelemetry-instrumentation-urllib #3639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

EzzioMoreira
Copy link
Contributor

@EzzioMoreira EzzioMoreira commented Jul 14, 2025

Description

A lot of code imports semantic conventions attributes from opentelemetry.semconv.trace.SpanAttributes instead of the preferred opentelemetry.semconv.attributes and opentelemetry.semconv.incubating.

This PR refactors the semantic conventions to use the new stable attribute modules instead of the deprecated SpanAttributes class.

Updates to instrumentation code:

  • Replaced references to SpanAttributes.HTTP_URL with HTTP_URL in response_hook and _instrumented_open_call methods for semantic convention compliance. [1] [2]

Updates to test cases:

  • Updated test cases in test_urllib_integration.py to use the new constants (HTTP_METHOD, HTTP_URL, HTTP_STATUS_CODE) instead of SpanAttributes. This change affects multiple test methods, including test_basic, test_not_foundbasic, and others. [1] [2] [3] [4] [5] [6] [7]

Refs: #3475

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@github-actions github-actions bot requested a review from shalevr July 14, 2025 11:28
@xrmx xrmx added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jul 16, 2025
@xrmx xrmx enabled auto-merge (squash) July 16, 2025 08:09
@xrmx xrmx merged commit f20fa77 into open-telemetry:main Jul 16, 2025
625 checks passed
@EzzioMoreira EzzioMoreira deleted the refactor/opentelemetry-instrumentation-urllib branch July 16, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants